# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="hclee"
__date__ ="$Dec 22, 2009 11:07:52 AM$"

import os
import sys
import tempfile
import output_util
import common_util

if __name__ == "__main__":
    title = 'the LEE family'
    header_list = ['name','age']
    rowdata_list = []
    rowdata_list.append({'name':'hclee', 'age':33})
    rowdata_list.append({'name':'frida', 'age':34})
    rowdata_list.append({'name':'wen-sheng lee', 'age':1})

    ## print data as a well-formated table
    output_util.table_output(title, header_list, rowdata_list, sys.stdout)

    (fd,name) = tempfile.mkstemp()

    fobj = os.fdopen(fd, 'w')
    common_util.log('file created for table output: %s' % name)
    output_util.table_output(title,header_list,rowdata_list,fobj)
    fobj.close()

    ## print data as a TAB-separated table
    output_util.tab_output(header_list, rowdata_list, sys.stdout)